package com.yqya.springboot.netty.socketio.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.yqya.springboot.netty.socketio.dto.PushUserMessageDTO;
import com.yqya.springboot.netty.socketio.service.NettySocketIOService;

/**
 * 用户
 *
 * @author Kevin
 * @date 2019-06-30
 */
@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private NettySocketIOService nettySocketIOService;

    /**
     * 给用户发送信息
     *
     * @param dto
     * @return
     */
    @RequestMapping(value = "/send_msg", method = RequestMethod.POST)
    @ResponseBody
    public String sendMsgToUser(@RequestBody PushUserMessageDTO dto) {
        nettySocketIOService.pushMessageToUser(dto);
        return "发送信息成功";
    }

}
